/**
 * 
 */
package good_src.tests;

import java.util.concurrent.ScheduledThreadPoolExecutor;

import good_src.Implementation.Canal;
import good_src.Implementation.ConcreteCapteur;
import good_src.Interfaces.Capteur;
import junit.framework.TestCase;

/**
 * @author Tangi Midy & Fabien Le Peih
 * 
 */
public class TestCanal extends TestCase {

	private Capteur<Integer> capteur;
	private Canal canal;

	/**
	 * @param name
	 */
	public TestCanal(String name) {
		super(name);
	}

	/**
	 * @see junit.framework.TestCase#setUp()
	 */
	protected void setUp() throws Exception {
		super.setUp();
		capteur = new ConcreteCapteur();
		canal = new Canal(capteur);
	}

	/**
	 * Test method for {@link good_src.Implementation.Canal#getValue()}.
	 */
	public void testGetValue() {
		canal.setScheduler(new ScheduledThreadPoolExecutor(10));
		assertTrue((Integer) canal.getValue() == 0);
		capteur.tick();
		assertTrue((Integer) canal.getValue() == 1);
	}

	/**
	 * Test method for {@link good_src.Implementation.Canal#getAfficheur()}.
	 */
	public void testGetAfficheur() {
		assertTrue(canal.getAfficheur() != null);
	}
}
